﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Pedidos.aspx.cs" Inherits="TVH.Exibicao.Pedidos" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
    <asp:HiddenField ID="hdnGridAction" runat="server" />
    <asp:HiddenField ID="hdnID" runat="server" />
    <asp:Label ID="lblMensagem" runat="server"></asp:Label>
    <div class="geral">
        <h1>
            Lista de Pedidos</h1>
        <div class="filtro" style="height: 20px">
            <div class="float-left">
                <div class="fields">
                    <div class="field">
                        <label class="normal">
                            Setor</label>
                            <asp:DropDownList runat="server" ID="ddlSetor" CssClass="size-350" AppendDataBoundItems="true">
                                <asp:ListItem Text="Selecione" Value="0" />
                            </asp:DropDownList>
                    </div>
                    <div class="field">
                        <asp:Button runat="server" ID="btnBuscar" Text="Buscar" CssClass="button" OnClick="btnBuscar_Click" />
                    </div>
                </div>
            </div>
        </div>
        <asp:GridView runat="server" ID="gridResultado" AllowPaging="true" AutoGenerateColumns="false"
            CssClass="grid" BorderWidth="0" GridLines="None" DataKeyNames="ID" PagerSettings-Position="TopAndBottom"
            AlternatingRowStyle-CssClass="odd" EmptyDataText="Não há dados a serem exibidos."
            OnRowDataBound="gridResultado_RowDataBound" OnRowDeleting="gridResultado_RowDeleting"
            OnRowEditing="gridResultado_RowEditing" OnPageIndexChanging="gridResultado_PageIndexChanging"
            OnSelectedIndexChanging="gridResultado_SelectedIndexChanging">
            <PagerTemplate>
                <div class="pagination">
                    <asp:LinkButton runat="server" CommandName="Page" CommandArgument="First" CssClass="button"><<</asp:LinkButton>
                    <asp:LinkButton runat="server" CommandName="Page" CommandArgument="Prev" CssClass="button"><</asp:LinkButton>
                    <span>Página
                        <%= gridResultado.PageIndex+1%>
                        de
                        <%= gridResultado.PageCount %></span>
                    <asp:LinkButton runat="server" CommandName="Page" CommandArgument="Next" CssClass="button">></asp:LinkButton>
                    <asp:LinkButton runat="server" CommandName="Page" CommandArgument="Last" CssClass="button">>></asp:LinkButton>
                </div>
            </PagerTemplate>
            <Columns>
                <asp:BoundField HeaderText="Produto" DataField="DescricaoProduto" />
                <asp:BoundField HeaderText="Quantidade" DataField="Quantidade" />
                <asp:BoundField HeaderText="Categoria" DataField="DescricaoCategoriaProduto" />
                <asp:BoundField HeaderText="Prédio" DataField="DescricaoPredio" />
                <asp:BoundField HeaderText="Quarto" DataField="DescricaoQuarto" />
                <asp:BoundField HeaderText="Tempo Decorrido" DataField="TempoDecorrido" DataFormatString="{0:hh\:mm}" />
                <asp:BoundField HeaderText="Status" DataField="Status" />
                <%--<asp:TemplateField HeaderText="Detalhar" ItemStyle-CssClass="center" HeaderStyle-CssClass="icon-header">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkDetalhar" CommandArgument='<%# Eval("ID") %>' CommandName="Select"
                            runat="server">
                            <img alt="Detalhar" runat="server" id="imgDetalhar" src="~/img/ico-read.png" />
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>--%>
                <asp:TemplateField HeaderText="Preparar" ItemStyle-CssClass="center" HeaderStyle-CssClass="icon-header">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkPreparar" CommandArgument='<%# Eval("ID") %>' CommandName="Edit"
                            runat="server">
                            <img alt="Preparar" runat="server" id="imgPreparar" src="~/img/ico-prepare.png" />
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Concluir" ItemStyle-CssClass="center" HeaderStyle-CssClass="icon-header">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkConcluir" CommandArgument='<%# Eval("ID") %>' CommandName="Delete"
                            runat="server">
                            <img alt="Concluir" runat="server" id="imgConcluir" src="~/img/ico-ok.png" />
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    
    <script type="text/javascript">
        setInterval(function () { document.getElementById('<%=btnBuscar.ClientID %>').click(); }, 1 * 6000);
    </script>
</asp:Content>
